]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Disable user list when no user
authorXiaoguang Wang <xwang@suse.com>
Fri, 7 Jul 2017 06:47:23 +0000 (14:47 +0800)
committerMichael Catanzaro <mcatanzaro@igalia.com>
Fri, 7 Jul 2017 16:21:09 +0000 (11:21 -0500)
https://bugzilla.gnome.org/show_bug.cgi?id=731320

js/gdm/loginDialog.js

index 094a1f96cec3d3b4b7af95515a36a62b36f8ece9..5055a0a58ac65bd59561dea03f4c8fab154e38f1 100644 (file)
@@ -269,6 +269,10 @@ const UserList = new Lang.Class({
 
         item.actor.destroy();
         delete this._items[userName];
+    },
+
+    numItems: function() {
+        return Object.keys(this._items).length;
     }
 });
 Signals.addSignalMethods(UserList.prototype);
@@ -707,6 +711,10 @@ const LoginDialog = new Lang.Class({
     _updateDisableUserList: function() {
         let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
 
+        // Disable user list when there are no users.
+        if (this._userListLoaded && this._userList.numItems() == 0)
+            disableUserList = true;
+
         if (disableUserList != this._disableUserList) {
             this._disableUserList = disableUserList;
 
@@ -1178,14 +1186,18 @@ const LoginDialog = new Lang.Class({
             this._userList.addUser(users[i]);
         }
 
+        this._updateDisableUserList();
+
         this._userAddedId = this._userManager.connect('user-added',
                                                       Lang.bind(this, function(userManager, user) {
                                                           this._userList.addUser(user);
+                                                          this._updateDisableUserList();
                                                       }));
 
         this._userRemovedId = this._userManager.connect('user-removed',
                                                         Lang.bind(this, function(userManager, user) {
                                                             this._userList.removeUser(user);
+                                                            this._updateDisableUserList();
                                                         }));
 
         this._userChangedId = this._userManager.connect('user-changed',
@@ -1194,6 +1206,7 @@ const LoginDialog = new Lang.Class({
                                                                 this._userList.removeUser(user);
                                                             else if (!this._userList.containsUser(user) && !user.locked)
                                                                 this._userList.addUser(user);
+                                                            this._updateDisableUserList();
                                                         }));
 
         return GLib.SOURCE_REMOVE;